package com.lagou.worker.controller;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ApolloTest
 * @Description TODO
 * @Author xsq
 * @Date 2020/7/29 17:00
 **/
@RestController
@RequestMapping("/apolloTest")
@Slf4j
public class ApolloTest {

    @ApolloConfig("application")
    private Config config;

    @Value("${eureka.client.service-url.defaultZone}")
    private String zone;

    @RequestMapping("/test1")
    public String test(){
        String defaultValue = config.getProperty("server.port", "defaultValue");
        log.info(defaultValue);
        log.info("------------zone-------"+zone);
        return defaultValue;
    }
}
